function infoMsg(title, msg) {
    iziToast.info({
        title: title,
        message: msg,
    });
}

function successMsg(title, msg, callback) {
    iziToast.success({
        title: title,
        message: msg,

        onClosing: function (instance, toast, closedBy) {
            if (callback != 'undefined' && callback != null) callback();
        }
    });
}

function resSuccessMsg(res) {
    if (res.data.message == 'undefined') {
        successMsg("成功", '操作成功');
        return;
    }
    successMsg("成功", res.data.message);
}

function warningMsg(title, msg) {
    iziToast.warning({
        title: title,
        message: msg,
    });
}

function errorMsg(title, msg) {
    iziToast.error({
        title: title,
        message: msg,
    });
}
function errorMsg(title, msg, callback) {
    iziToast.error({
        title: title,
        message: msg,
        timeout: 1500,
        onClosing: function (instance, toast, closedBy) {
            if (callback != 'undefined' && callback != null) callback();
        }
    });
}

function idIsNullOrEmptyErrorMsg() {
    errorMsg("错误", "id不能为空！");
}

function welcome(title, msg, timeout, callback) {
    iziToast.show({
        theme: 'dark',
        icon: 'icon-person',
        title: title,
        message: msg,
        timeout: timeout ? timeout : 5000,
        position: 'topCenter', // bottomRight, bottomLeft, topRight, topLeft, topCenter, bottomCenter
        progressBarColor: 'rgb(0, 255, 184)',
        buttons: [
            //['<button>Ok</button>', function (instance, toast) {
            //    alert("Hello world!");
            //}, true], // true to focus
            ['<button>Close</button>', function (instance, toast) {
                instance.hide({
                    transitionOut: 'fadeOutUp',
                    onClosing: function (instance, toast, closedBy) {
                        console.info('closedBy: ' + closedBy); // The return will be: 'closedBy: buttonName'
                    }
                }, toast, 'buttonName');
            }]
        ],
        onOpening: function (instance, toast) {
            console.info('callback abriu!');
        },
        onClosing: function (instance, toast, closedBy) {
            callback();
            console.info('closedBy: ' + closedBy); // tells if it was closed by 'drag' or 'button'
        }
    });
}